<#assign base=request.contextPath />
<html style="font-size:50px;" ng-app="app">
<head>
    <meta charset="utf-8">
    <title>个人资料</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, user-scalable=no">
    <meta name="format-detection" content="telephone=no,email=no" />
	<link type="text/css" rel="stylesheet" href="${base}/css/profile.css" />
	<link href="${base}/css/mui.picker.min.css" rel="stylesheet" />
    <link href="${base}/css/mui.poppicker.css" rel="stylesheet" />
    <link href="${base}/css/mui.min.css" rel="stylesheet" />
     <link href="${base}/css/customer.css" rel="stylesheet" />
    
</head>
<body  ng-controller="ProfileCtrl">
<input type="hidden" id="tabIndex" value="${tabIndex}" >
		<input type="hidden" id="stid" value="${storeId}"/ >
		<input type="hidden" id="redirecturl" value="${redirecturl}"/ >
	<header>
		<div class="header-body">
			<div class="user">
				<img ng-src="{{picurl}}" />
				<span>昵称：{{memberName || '西门子会员'}}</span>
				<p>NO：{{member.cardNo}}</p>
			</div>
			<div class="card">
				<div class="card-body card{{member.tier}}">
                 
                </div>
			</div>
		</div>
		<div class="header-footer">
            <div class="btn-border">
                <img src="${base}/img/profile_score.png" />
                <span>会员积分</span><span>|</span><span>{{total}}</span>
            </div>
           
		</div>
		<table class="table-header">
			<tr>
				<td>
					<div class="user">
						<img ng-src="{{picurl}}" />
                        <span>昵称：{{memberName || '西门子会员'}}</span>
						<p>NO：{{member.cardNo}}</p>
					</div>
				</td>
				<td>
					<div class="card">
						<div class="card-body card{{member.tier}}">
		                   
		                </div>
					</div>
				</td>
			</tr>
		</table>
		<table class="table-footer">
			<tr>
				<th>
					 <div class="btn-border">
		                <img src="${base}/img/profile_score.png" />
		                <span>会员积分</span><span>|</span><span>{{total}}</span>
		            </div>
		            
	            </th>
			</tr>
		</table>
	</header>
	<div class="info-body">
		<div class="tab">
			<div title="1" class="select">
				<img src="${base}/img/profile_icon_person.png" />
				<span>个人信息</span>
			</div>
			<div title="2">
				<img src="${base}/img/profile_icon_history.png" />
				<span>历史积分</span>
			</div>
			<div title="3">
				<img src="${base}/img/profile_icon_record.png" />
				<span>交易记录</span>
			</div>
			<div title="4">
				<img src="${base}/img/product.png" />
				<span>我的产品</span>
			</div>
		</div>
		<div class="show-body">
			<div class="profile-body">
				<form>
					<div class="one">
						<p>联系方式</p>
						<div class="form-body">
							<div class="border-bottom-1px">
								<i>*</i><input  type="text" class="full"  id="mobile" ng-model="member.tel" maxlength="15" placeholder="请输入手机号码"/>
							</div>
						</div>
					</div>
					<div class="one">
						<p>我们该如何称呼您</p>
						<div class="form-body">
							<div class="border-bottom-1px">
								<i>*</i><input type="text" class="name" id="memberName" ng-model="member.name" maxlength="20" placeholder="姓名"/>
							</div>
							<div class="border-bottom-1px">
								<i>*</i>
								<select class="sex"  id="gender" ng-model="member.gender">
									<option value="其他" ng-selected="!member || !member.gender||member.gender=='其他'">称谓</option>
									<option value="男" ng-selected="member.gender=='男'">先生</option>
									<option value="女" ng-selected="member.gender=='女'">女士</option>
								</select><img class="mobile" src="${base}/img/icon_down.png">
							</div>
						</div>
					</div>
					<div class="one">
						<p>出生日期</p>
						<div class="pc form-body">
							<div class="border-bottom-1px">
								<i>*</i><select class="three" id="birthyear" ng-model="member.birthyear" ng-options="year for year in years | orderBy:'-'" ng-disabled="disableBirthFlag">
								</select>
							</div>
							<div class="border-bottom-1px">
								<i>*</i><select class="three"  id="birthmonth" ng-model="member.birthmonth" ng-options="month for month in months" ng-disabled="disableBirthFlag">
								</select>
							</div>
							<div class="border-bottom-1px">
								<i>*</i><select class="three"  id="birthday" ng-model="member.birthday" ng-options="day for day in getDays()" ng-disabled="disableBirthFlag">
								</select>
							</div>
						</div>
						<div class="mobile form-body">
							<div class="birth border-bottom-1px" ng-click="openMobileBirth()" id="birthDiv" >
								<i>*</i><input type="text" placeholder="请选择出生日期" ng-model="member.fullBirthday"  ng-disabled="disableBirthFlag"/>
							</div>
						</div>
						<span style="color:red;font-size:12px">注：未完善生日信息的,只允许修改一次</span>
					</div>
					<div class="one">
						<p>收货地址 </p>
						<div class="pc form-body">
							<div class="border-bottom-1px">
								<i>*</i><select class="three" ng-model="province" ng-options="province.text for province in provinces">
									<option value="0" selected="selected">省</option>
								</select>
							</div>
							<div class="border-bottom-1px">
								<i>*</i><select class="three" ng-model="city" ng-options="city.text for city in province.children">
									<option value="1" selected="selected">市</option>
								</select>
							</div>
							<div class="border-bottom-1px">
								<i>*</i><select class="three" ng-model="district" ng-options="district.text for district in city.children">
									<option value="1" selected="selected">区</option>
								</select>
							</div>
						</div>
						<div class="mobile form-body">
							<div class="picker border-bottom-1px" ng-click="openPickerData()">
								<i>*</i><input type="text" placeholder="请选择省市区"  ng-model="picker"/>
							</div>
						</div>
						<div class="form-body" style="margin-top:30pt;">
							<div class="border-bottom-1px">
								<input type="text" class="full" placeholder="请输入收货地址（选填）" ng-model="member.address4"/>
							</div>
						</div>
					</div>
					<div class="one">
						<p>邮箱</p>
						<div class="form-body">
							<div class="border-bottom-1px">
								<input type="text" class="full" placeholder="请输入邮箱（选填）"  ng-model="member.email"/>
							</div>
						</div>
					</div>
				</form>
				<div class="button-body">
					<button ng-click="saveMember()">保存</button>
					<button ng-click="resetMember()">取消</button>
				</div>
			</div>
			<div class="hide score-body">
		        <table border="0" cellpadding="0" cellspacing="0" >
		            <tr>
		                <th>时间</th>
		                <th>事件</th>
		                <th>积分</th>
		            </tr>
		            <tr ng-repeat="point in points">
		                <td> {{point.pointDT.substring(0,10)}}</td>
		                <td>  {{point.pointOperationTypeDesc}}</td>
		                <td><span ng-if="point.pointValue >0">+</span> {{point.pointValue | number:0}}</td>
		            </tr>
		          
		             <tr ng-if="!points || points.length == 0">
		                 <td></td>
		                <td>没有数据</td>
		                <td></td>
		            </tr>
		        </table>    
			</div>
			<div class="hide record-body">
		        <table border="0" cellpadding="0" cellspacing="0">
		            <tr>
		                <th>订单号</th>
		                <th>交易时间</th>
		                <th>交易金额</th>
		            </tr>
		            <tr ng-repeat="purchase in purchases">
		                <td>{{purchase.psn}}</td>
		                <td>{{purchase.pdt.substring(0,10)}}</td>
		                <td>{{purchase.amount | number:0}} 元</td>
		            </tr>
		            <tr ng-if="!purchases || purchases.length == 0">
		                <td></td>
		                <td>没有数据</td>
		                <td></td>
		            </tr>
		          
		        </table>    
			</div>
			<div class="hide product-body">
		        <table border="0" cellpadding="0" cellspacing="0">
		            <tr>
		            	<th></th>
		                <th>交易时间</th>
		                <th>产品型号</th>
		                <th>产品类型</th>
		                <th>状态</th>
		            </tr>
		            <tr ng-class="{'disable-click' :  product.regStatus == 1}" ng-repeat="product in products" >
		            	<td class="icon" ng-click="product.checked = !product.checked">
		               		 <img  class="unselect" ng-show="product.regStatus == 0 && !product.checked" src="${base}/img/product_unselect.png">
		                	 <img class="select" ng-show="product.regStatus == 0 && product.checked" src="${base}/img/product_select.png">
		                </td>
		                <td>{{product.purDT.substring(0,10)}}</td>
		                <td>{{product.productCategoryCode|cut:true:13:'...'}}</td>
		                <td>{{product.skuName|strfilter:""}}</td>
		                <td>
		                	<img  ng-show="product.regStatus == 1"  src="${base}/img/staus_org.png" />
		                	<img  ng-show="product.regStatus == 0"  src="${base}/img/status_blue.png">
		                </td>
		            </tr>
		        </table>    
		        <a href="${base}/repair/${storeId}">点击前往申请延保 ></a>
		        <div class="button-body">
					<button class="register" ng-click="registeProducts()">注册</button>
					<button class="cancel" ng-click="cancelProducts()">取消</button>
				</div>
			</div>
		</div>
	</div>
	<footer>
          <a href="${redirecturl}">返回首页</a>
    </footer>
     <div class="alert hide">
		<div class="alert-body">
			<h6>提示</h6>
			<img src="${base}/img/alert.png" />
			<p id="sucMsg">注册成功</p>
			<button>完成</button>
		</div>
	</div>
	 <div class="alert-error hide">
		<div class="alert-body">
			<h6>提示</h6>
			<img src="${base}/img/alert_error.png" />
			<p  id="failMsg">注册失败</p>
			<button>完成</button>
		</div>
	</div>
	<script type="text/javascript" src="${base}/js/lib/jquery.min.js"></script>
	<script src="${base}/js/lib/mui.min.js"></script>
	<script type="text/javascript" src="${base}/js/lib/mui.picker.min.js"></script>

	
	<script type="text/javascript" src="${base}/js/lib/angular.min.js"></script>
    <script type="text/javascript" src="${base}/js/app/app.js"></script>
    <script type="text/javascript" src="${base}/js/app/service/address.js"></script>
    <script type="text/javascript" src="${base}/js/app/service/date.js"></script>
    <script type="text/javascript" src="${base}/js/app/service/apiService.js"></script>
    <script type="text/javascript" src="${base}/js/app/service/filter.js"></script>
    <script type="text/javascript" src="${base}/js/app/controller/profile.js"></script>
	
	
	<script type="text/javascript">

		$('.tab div').click(function(e){
			if(!$(this).hasClass('select')){
				$('.tab div').removeClass('select');
				$(this).addClass('select')
			}
			$('.profile-body').addClass('hide');
			$('.score-body').addClass('hide');
			$('.record-body').addClass('hide');
			$('.product-body').addClass('hide');

			switch(Number(e.currentTarget.title)){
				case 1: {
					$('.profile-body').removeClass('hide');
					break;
				}
				case 2:{
					$('.score-body').removeClass('hide');
					break;
				}
				case 3:{
					$('.record-body').removeClass('hide');
					break;
				}
				case 4:{
					$('.product-body').removeClass('hide');
					$('.product-body .button-body').removeClass('hide')
					break;
				}
			}
		})
		
		var tabIndex=$("#tabIndex").val();
		console.log(tabIndex);
		if((typeof(tabIndex) != "undefined")&&tabIndex!=null){
		   		var idx=parseInt(tabIndex);
				if(idx==4){
					$('.tab div:last').trigger("click");
				}
		}
	
	
		$('.alert button,.alert-error button').click(function(){
			if(!$('.alert').hasClass('hide')){
				$('.alert').addClass('hide');
			}
			if(!$('.alert-error').hasClass('hide')){
				$('.alert-error').addClass('hide');
			}
		})
		
	</script>
</body>